package com.service.impl;

import com.entity.Address;
import com.mapper.AddressMapper;
import com.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("addressService")
@Transactional
public class AddressServiceImpl implements AddressService {
    @Autowired
    private AddressMapper addressMapper;
    @Override
    public void insertAddress(Address addr) {
        addressMapper.insertAddress(addr);
    }

    @Override
    public void deleteAddressById(Integer id) {
        addressMapper.deleteAddressById(id);
    }

    @Override
    public void updateAddress(Address address) {
        addressMapper.updateAddress(address);
    }

    @Override
    public Address selectAddressById(Integer id) {
        return addressMapper.selectAddressById(id);
    }

    @Override
    public Address selectAddressByName(String name) {
        return addressMapper.selectAddressByName(name);
    }

    @Override
    public List<Address> selectAddress(Integer user_id) {
        return addressMapper.selectAddress(user_id);
    }

    @Override
    public List<Address> selectPageAddress(Integer pageNum, Integer pageSize) {
        return addressMapper.selectPageAddress(pageNum,pageSize);
    }
}
